package com.icinfo.cloud.provider.punish.common.publicsecurityentrust.mapper;

import com.icinfo.cloud.provider.punish.common.publicsecurityentrust.model.CasePublicSecurityEntrustDocumentNumber;
import com.icinfo.cloud.provider.punish.common.publicsecurityentrust.model.CasePublicSecurityEntrustDocumentNumberSegment;
import com.icinfo.cloud.provider.punish.common.publicsecurityentrust.vo.SegmentUsedNumberCountVo;
import com.icinfo.framework.mybatis.mapper.common.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface CasePublicSecurityEntrustDocumentNumberSegmentMapper extends Mapper<CasePublicSecurityEntrustDocumentNumberSegment> {

    /**
     * 批量新增号段
     *
     * @param segmentList
     */
    void insertBatch(@Param("segmentList") List<CasePublicSecurityEntrustDocumentNumberSegment> segmentList);


    /**
     * 根据公安委托文号（中间九位）、委托部门编码、当前用户部门编码获取街道文号信息
     * @param documentNumber 文号（中间九位）
     * @param orgCode 委托机构编码
     * @return
     */
    CasePublicSecurityEntrustDocumentNumberSegment getDocumentNumberByEntrustOrgCodeAndOrgCodeAndDocumentNumber(@Param("documentNumber")String documentNumber,
                                                                                  @Param("entrustOrgCode")String entrustOrgCode,
                                                                                  @Param("orgCode")String orgCode);

    /**
     * 根据文号id分组对已使用数量求和
     * @return
     */
    List<SegmentUsedNumberCountVo> groupUsedNumberCountSumByDocumentNumberIds(@Param("ids") List<String> ids);

}